/*
 * @(#) JobServiceImpl.java 2011-9-7
 *
 * Copyright (c) 2011, Strong Technology. All Rights Reserved.
 * Strong Technology. CONFIDENTIAL
 */
package cn.strong.gweva.system.business.service.impl;

import java.util.Date;
import java.util.List;

import cn.strong.gweva.common.business.entity.PagerEntity;
import cn.strong.gweva.common.business.entity.db.JxkhJobEntity;
import cn.strong.gweva.common.business.service.impl.AbstractServiceImpl;
import cn.strong.gweva.common.util.Constants;
import cn.strong.gweva.common.util.Constants4Method;
import cn.strong.gweva.system.business.entity.JobSearchEntity;
import cn.strong.gweva.system.business.service.JobService;


/**
 * 岗位管理实现类.
 * 
 * @author jincong
 * @version 1.0
 * @since 2011-9-7
 */
public class JobServiceImpl extends AbstractServiceImpl implements JobService
{

	/**
	 * 新增岗位.
	 * 
	 * @param job 岗位信息
	 * @throws Exception 异常
	 */
	public void insert(JxkhJobEntity job) throws Exception
	{
		job.setDelFlag(Constants.DEL_FLAG_NO);
		job.setUpdateTime(new Date());
		this.getCommonDao().insert(Constants4Method.SYSTEM_JOB_INSERT_JXKH_JOB, job);
	}

	/**
	 * 更新岗位.
	 * 
	 * @param job 岗位信息
	 * @throws Exception 异常
	 */
	public void update(JxkhJobEntity job) throws Exception
	{
		job.setUpdateTime(new Date());
		this.getCommonDao().update(Constants4Method.SYSTEM_JOB_UPDATE_JXKH_JOB, job);
	}

	/**
	 * 逻辑删除岗位信息.
	 * 
	 * @param job 岗位信息
	 * @throws Exception 异常
	 */
	public void logicDeleteJob(JxkhJobEntity job) throws Exception
	{
		job.setUpdateTime(new Date());
		job.setDelFlag(Constants.DEL_FLAG_YES);
		this.getCommonDao().update(Constants4Method.SYSTEM_JOB_LOGIC_DELETE_JOB, job);
	}

	/**
	 * 删除岗位信息.
	 * 
	 * @param job 岗位信息
	 * @throws Exception 异常
	 */
	public void delete(JxkhJobEntity job) throws Exception
	{
		this.getCommonDao().delete(Constants4Method.SYSTEM_JOB_DELETE_JXKH_JOB, job);
	}

	/**
	 * 查询岗位列表.
	 * 
	 * @return 岗位列表信息
	 * @throws Exception 异常
	 */
	@SuppressWarnings("unchecked")
	public List<JxkhJobEntity> searchJobList() throws Exception
	{
		return this.getCommonDao().searchList(Constants4Method.SYSTEM_JOB_SEARCH_JOB_LIST, null);
	}

	/**
	 * 岗位分页查询.
	 * 
	 * @param pagerEntity
	 * @return 岗位分页信息
	 * @throws Exception 异常
	 */
	public PagerEntity searchJobPage(PagerEntity pagerEntity, JobSearchEntity jobSearchEntity)
			throws Exception
	{
		return this.getCommonDao().searchPager(pagerEntity,
				Constants4Method.SYSTEM_JOB_SEARCH_JOB_LIST, jobSearchEntity);
	}

	/**
	 * 根据岗位ID查询岗位信息.
	 * 
	 * @param jxkhJobEntity 岗位信息
	 * @return 岗位信息
	 * @throws Exception 异常
	 */
	public JxkhJobEntity searchJobById(JxkhJobEntity jxkhJobEntity) throws Exception
	{
		return (JxkhJobEntity)this.getCommonDao().searchObj(
				Constants4Method.SYSTEM_JOB_SEARCH_JOB_BY_ID, jxkhJobEntity);
	}
}
